/**
 * Copyright (c) 2010 CWI Amsterdam and others. All rights reserved.
 * This program and the accompanying materials are made available
 * under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 * 
 * Contributors:
 *     CWI Amsterdam - initial API and implementation
 *
 * $Id$
 */
package nl.cwi.arne.ui.parts;

import nl.cwi.arne.mcrl2.util.MCRL2Options;
import nl.cwi.arne.mcrl2.util.MCRL2Options.Equivalence;
import nl.cwi.arne.ui.ArnePreferences;
import nl.cwi.arne.ui.ArneUIPlugin;

import org.eclipse.jface.preference.BooleanFieldEditor;
import org.eclipse.jface.preference.FieldEditorPreferencePage;
import org.eclipse.jface.preference.RadioGroupFieldEditor;
import org.eclipse.ui.IWorkbench;
import org.eclipse.ui.IWorkbenchPreferencePage;

/**
 * General preference page.
 * @author Christian Krause
 */
public class GeneralPreferencePage extends FieldEditorPreferencePage implements IWorkbenchPreferencePage {

	/**
	 * Default constructor.
	 */
	public GeneralPreferencePage() {
		super(GRID);
		setPreferenceStore(ArneUIPlugin.getInstance().getPreferenceStore());
		// setDescription("Set the mCRL2 preferences.");
	}
	
	/*
	 * (non-Javadoc)
	 * @see org.eclipse.jface.preference.FieldEditorPreferencePage#createFieldEditors()
	 */
	@Override
	public void createFieldEditors() {
		
		addField(new BooleanFieldEditor(ArnePreferences.WITH_ZERO_CHANGES, "With &zero changes", getFieldEditorParent()));
		addField(new BooleanFieldEditor(ArnePreferences.START_FROM_ZERO_CHANGE, "&Start from zero change", getFieldEditorParent()));
		addField(new BooleanFieldEditor(ArnePreferences.DELTA_LABELS, "&Delta labels", getFieldEditorParent()));
		addField(new BooleanFieldEditor(ArnePreferences.VERBOSE_LABELS, "&Verbose labels", getFieldEditorParent()));
		
		addField(new BooleanFieldEditor(MCRL2Options.LTSCONVERT, "&Minimize labeled transition systems", getFieldEditorParent()));
		addField(new BooleanFieldEditor(ArnePreferences.REMOVE_INITIAL_STATES, "&Remove dummy initial states when showing LTS", getFieldEditorParent()));
		addField(new BooleanFieldEditor(ArnePreferences.AUTO_SAVE, "&Auto save on activation generation", getFieldEditorParent()));
				
		// Equivalences
		Equivalence[] equivalences = MCRL2Options.Equivalence.values();
		String[][] values = new String[equivalences.length][];
		for (int i=0; i<values.length; i++) {
			values[i] = new String[] { equivalences[i].toString(), equivalences[i].name() };
		}
		addField(new RadioGroupFieldEditor(MCRL2Options.EQUIVALENCE, "&Behavioral equivalence", 1, values, getFieldEditorParent()));
		
	}
	
	/* (non-Javadoc)
	 * @see org.eclipse.ui.IWorkbenchPreferencePage#init(org.eclipse.ui.IWorkbench)
	 */
	public void init(IWorkbench workbench) {
	}
	
}